﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Splittergame
{
    class Camera
    {
        Vector2 m_resolution;
        private float displaceX = 0;
        private float displaceY = 0;
        private float scaleX;
        private float scaleY;


        public Camera(Viewport port)
        {

            scaleX = port.Width / 10;
            scaleY = port.Height / 10;
            m_resolution.X = port.Width;
            m_resolution.Y = port.Height;

            //System.Diagnostics.Debug.WriteLine(m_resolution);
        }


        public Vector2 GetVisual(Vector2 logical) 
        {
            logical.X = logical.X * scaleX;
            logical.Y = logical.Y * scaleY;

            return logical;
        
        }
        public int GetOffsetX()
        {
            int offset = (int)(0.05f * m_resolution.X);

            return offset;

        }
        public int GetOffsetY()
        {
            int offset = (int)(0.05f * m_resolution.Y);

            return offset;

        }
        internal Rectangle getVisualRect(float logicalX, float logicalY, float modelRadius)
        {

            float ViewRadiusX = modelRadius * scaleX;
            float ViewRadiusY = modelRadius * scaleY;

            int screenX = (int)((logicalX * scaleX) - ViewRadiusX);
            int screenY = (int)((logicalY * scaleY) - ViewRadiusY);

            return new Rectangle(screenX, screenY, (int)(ViewRadiusX * 2.0f), (int)(ViewRadiusY * 2.0f));
        
        }
        internal Rectangle getRamRectangle(Vector2 ramPosition) 
        {
            return new Rectangle((int)ramPosition.X, (int)ramPosition.Y, (int)m_resolution.X - GetOffsetX() * 2, (int)m_resolution.Y - GetOffsetY() * 2);
        }

        internal int VisualBallSize(int radius)
        {

            return radius * (int)m_resolution.X;
        }

    }
}
